# !/bin/sh


cd "simpleCodingQuiz-${BUILD_NUMBER}"
git checkout $branch
ANSWER_BRANCH="$( git branch -r | grep answer )"
if [ "$ANSWER_BRANCH" = ""  ];then
    ../echoMessage.sh '检测到无answer分支，将不会创建答案。'
else
    git checkout answer
    mv .git ../.git
    tar -zcvf answer.zip ./*

    ../echoMessage.sh '检测到answer分支，正在创建答案。'
    curl -X PUT  \
        -F "answer=@answer.zip" \
        -F "buildNumber=${BUILD_NUMBER}" \
        $callback_url'/answerFile'
    mv ../.git ./.git
    rm answer.zip
    git checkout $branch
    ../echoMessage.sh '创建答案成功。'
fi



